package model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Tpermission entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "tpermission", catalog = "test")
public class Tpermission implements java.io.Serializable {

	// Fields

	private String id;
	private Tpermission tpermission;
	private String text;
	private String sort;
	private String type;
	private String url;
	private String permcode;
	private String state;
	private String description;
	private String iconCls;
	private Set<Tpermission> tpermissions = new HashSet<Tpermission>(0);
	private Set<Trolepermission> trolepermissions = new HashSet<Trolepermission>(0);

	// Constructors

	/** default constructor */
	public Tpermission() {
	}

	/** minimal constructor */
	public Tpermission(String id) {
		this.id = id;
	}

	/** full constructor */
	public Tpermission(String id, Tpermission tpermission, String text, String sort, String type, String url, String permcode, String state, String description, String iconCls, Set<Tpermission> tpermissions, Set<Trolepermission> trolepermissions) {
		this.id = id;
		this.tpermission = tpermission;
		this.text = text;
		this.sort = sort;
		this.type = type;
		this.url = url;
		this.permcode = permcode;
		this.state = state;
		this.description = description;
		this.iconCls = iconCls;
		this.tpermissions = tpermissions;
		this.trolepermissions = trolepermissions;
	}

	// Property accessors
	@Id
	@Column(name = "id", unique = true, nullable = false)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "pid")
	public Tpermission getTpermission() {
		return this.tpermission;
	}

	public void setTpermission(Tpermission tpermission) {
		this.tpermission = tpermission;
	}

	@Column(name = "text")
	public String getText() {
		return this.text;
	}

	public void setText(String text) {
		this.text = text;
	}

	@Column(name = "sort")
	public String getSort() {
		return this.sort;
	}

	public void setSort(String sort) {
		this.sort = sort;
	}

	@Column(name = "type")
	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Column(name = "url")
	public String getUrl() {
		return this.url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	@Column(name = "permcode")
	public String getPermcode() {
		return this.permcode;
	}

	public void setPermcode(String permcode) {
		this.permcode = permcode;
	}

	@Column(name = "state")
	public String getState() {
		return this.state;
	}

	public void setState(String state) {
		this.state = state;
	}

	@Column(name = "description")
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "iconCls")
	public String getIconCls() {
		return this.iconCls;
	}

	public void setIconCls(String iconCls) {
		this.iconCls = iconCls;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tpermission")
	public Set<Tpermission> getTpermissions() {
		return this.tpermissions;
	}

	public void setTpermissions(Set<Tpermission> tpermissions) {
		this.tpermissions = tpermissions;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tpermission")
	public Set<Trolepermission> getTrolepermissions() {
		return this.trolepermissions;
	}

	public void setTrolepermissions(Set<Trolepermission> trolepermissions) {
		this.trolepermissions = trolepermissions;
	}

}